﻿Ext.define('passport.model.FactoryModel', {
    extend: 'Ext.data.Model',
    alias: 'widget.factoryModel',
    requires: ['Ext.data.UuidGenerator'],
    idgen: 'uuid',
    fields: 
	    [
	    	{name: 'id',					type: 'string'}, 
	    	{name: 'code', 				type: 'string'},
	    	{name: 'shortName', 	type: 'string'},
	    	{name: 'fullName', 		type: 'string'},
	    	{name: 'location', 		type: 'string'},
	    	{name: 'address', 		type: 'string'},
	    	{name: 'tel', 				type: 'string'},
	    	{name: 'contact', 		type: 'string'},
	    	{name: 'isActive',		type: 'string'}
	    ], 
	  doSomethingHere: function() {
	   	
	  },
	  validations: [
	  	{type: 'presence', field: 'code'},
	  	{type: 'presence', field: 'shortName'},
	  	{type: 'presence', field: 'fullName'},
	  	{type: 'presence', field: 'location'},
	  	{type: 'presence', field: 'adddress'},
	  	{type: 'presence', field: 'tel'},
	  	{type: 'presence', field: 'contact'},
	  	{type: 'length', field: 'code', max: 3, min: 3},
	  	{type: 'length', field: 'isActive', max: 1},
	  	{type: 'inclusion', field: 'isActive', list: ['1', '0']}
	  	
	  ],
	  proxy: {
	  	type: 'ajax',
	  	url:'http://192.168.1.116:8077/Gateway.ashx?module=organization&action=Factory&method=save',
	  	api: 
        {
        	destroy: 'http://192.168.1.116:8077/Gateway.ashx?module=organization&action=Factory&method=delete'
        }
	  },
	  idProperty: 'Id'
});
